package org.finmanager.core;

/**
 * Created by Kelvin on 20/3/2014.
 *
 * This is the Category class
 * Each instance represents a category of an item
 * See CategoryList class for the abstract list of categories
 */
public class Category implements Comparable {
	//NAME
	//Indicator whether it is favourite (sensed in the functions) 
	//Indicator whether it is filtered (sensed in other functions)
	private String name;
	private Boolean favourite;
	private Boolean filterSelected;

	public Category(String name) {
		this.name = name;
		favourite = false;
		filterSelected = true;
	}

	public Category(String name, Boolean favourite) {
		this.name = name;
		this.favourite = favourite;
		filterSelected = true;
	}

	public String getName() {
		return name;
	}

	public boolean isFavourite() {
		return favourite;
	}

	public boolean isFilterSelected() {
		return filterSelected;
	}

	public void toggleFavourite() {
		favourite = !favourite;
	}

	public void toggleFilterSelection() {
		filterSelected = !filterSelected;
	}

	public void resetFilterSelection() {
		filterSelected = true;
	}

	@Override
	public String toString() {
		return getName();
	}

	@Override
	public int compareTo(Object o) {
		return this.toString().compareTo(o.toString());
	}
}
